<template>
  <div class="login-container">
    <div class="header">
      <el-form
        :inline="true"
        :model="formInline"
        class="demo-form-inline"
      >
        <el-form-item label="登录名称">
          <el-input
            v-model="input"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item label="用户姓名：">
          <el-input
            v-model="input1"
            placeholder="请输入内容"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="text"
            icon="el-icon-search"
          >查找</el-button>
        </el-form-item>
        <el-form-item>
          <el-button
            type="text"
            icon="el-icon-close"
          >清空</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="operation">
      <div>
        <el-button
          type="primary"
          plain
          icon="el-icon-circle-plus-outline"
          @click="handleClick"
        >增加</el-button>
        <el-button
          type="success"
          plain
          icon="el-icon-setting"
          @click="edit"
        >编辑</el-button>

        <el-button
          type="warning"
          plain
          icon="el-icon-delete"
        >删除</el-button>
      </div>
    </div>
    <div class="box">

      <el-table
        ref="multipleTable"
        tooltip-effect="dark"
        :data="tableData"
        style="width: 100%"
        :row-class-name="tableRowClassName"
        @selection-change="handleSelectionChange"
      >
        <el-table-column
          type="selection"
          width="55"
        />
        <el-table-column
          prop="date"
          label="登录账号"

          align="center"
        />
        <el-table-column
          prop="name"
          label="用户姓名"

          align="center"
        />
        <el-table-column
          prop="name"
          label="手机号"

          align="center"
        />
        <el-table-column
          prop="name"
          label="地区"
          align="center"
        />
        <!-- <el-table-column
              fixed="right"
              label="操作"
              width="200"
              align="center"
            >
              <template slot-scope="scope">

              </template>
            </el-table-column> -->
      </el-table>

    </div>
    <!-- 增加按钮弹出框 -->
    <el-dialog
      :visible.sync="dialogVisibleDistribution"
      width="50%"
    >
      <div class="header-title">
        <div
          style="
            padding: 15px 20px;
            color: #fff;
            text-align: center;
            font-weight: bold;
          "
        >
          添加字典信息
        </div>
        <div
          class="closeing"
          @click="CloseOne"
        >
          <i class="el-icon-close iconc" />
        </div>
      </div>
      <div>
        <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
          <el-form-item label="字典名称">
            <el-form :inline="true" :model="formInline" class="demo-form-inline">
              <el-form-item>
                <el-input v-model="formInline.user" placeholder="" />
              </el-form-item>
              <el-form-item label="字典代码">
                <el-input v-model="formInline.user" placeholder="" />
              </el-form-item>
            </el-form>
          </el-form-item>
          <el-form-item label="备注说明" prop="desc">
            <el-input v-model="ruleForm.desc" type="textarea" />
          </el-form-item>
          <div class="table-box">
            <div>
              <el-button
                type="text"
                @click="handleClick"
              >增加</el-button>
              <el-button
                type="text"
                @click="edit"
              >编辑</el-button>

              <el-button type="text">删除</el-button>

            </div>
            <el-form
              :inline="true"
              :model="formInline"
              class="demo-form-inline"
            >
              <el-form-item label="配置名称：">
                <el-input
                  v-model="input"
                  placeholder="请输入内容"
                />
              </el-form-item>
              <el-form-item label="配置代码：">
                <el-input
                  v-model="input1"
                  placeholder="请输入内容"
                />
              </el-form-item>
              <el-form-item>
                <el-button
                  type="text"
                  icon="el-icon-search"
                >确定添加子项</el-button>
              </el-form-item>
            </el-form>
          </div>
        </el-form>
      </div>
      <span
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          type="success"
          @click="confirm"
        >确 定</el-button>
      </span>
    </el-dialog>
    <!-- 编辑按钮弹出框 -->
    <el-dialog
      :visible.sync="dialogVisibleDistribianji"
      width="50%"
    >
      <div class="header-title">
        <div
          style="
            padding: 15px 20px;
            color: #fff;
            text-align: center;
            font-weight: bold;
          "
        >
          添加字典信息
        </div>
        <div
          class="closeing"
          @click="CloseOne"
        >
          <i class="el-icon-close iconc" />
        </div>
      </div>
      <div>
        <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
          <el-form-item label="字典名称">
            <el-form :inline="true" :model="formInline" class="demo-form-inline">
              <el-form-item>
                <el-input v-model="formInline.user" placeholder="" />
              </el-form-item>
              <el-form-item label="字典代码">
                <el-input v-model="formInline.user" placeholder="" />
              </el-form-item>
            </el-form>
          </el-form-item>
          <el-form-item label="备注说明" prop="desc">
            <el-input v-model="ruleForm.desc" type="textarea" />
          </el-form-item>
          <div class="table-box">
            <div>
              <el-button
                type="text"
                @click="handleClick"
              >增加</el-button>
              <el-button
                type="text"
                @click="edit"
              >编辑</el-button>

              <el-button type="text">删除</el-button>

            </div>
            <el-form
              :inline="true"
              :model="formInline"
              class="demo-form-inline"
            >
              <el-form-item label="配置名称：">
                <el-input
                  v-model="input"
                  placeholder="请输入内容"
                />
              </el-form-item>
              <el-form-item label="配置代码：">
                <el-input
                  v-model="input1"
                  placeholder="请输入内容"
                />
              </el-form-item>
              <el-form-item>
                <el-button
                  type="text"
                  icon="el-icon-search"
                >确定添加子项</el-button>
              </el-form-item>
            </el-form>
          </div>
        </el-form>
      </div>
      <span
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          type="success"
          @click="confirm"
        >确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'LoginIndex',
  components: {},
  props: {},
  data() {
    return {
      dialogVisibleDistribution: false,
      dialogVisibleDistribianji: false,
      input: '',
      input1: '',
      formInline: {
        user: '',
        region: ''
      },
      tableData: [
        {
          date: '----',
          name: '----',
          address: '----'
        },
        {
          date: '----',
          name: '----',
          address: '----'
        },
        {
          date: '----',
          name: '----',
          address: '----'
        }
      ],
      ruleForm: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      },
      rules: {
        name: [
          { required: true, message: '请输入活动名称', trigger: 'blur' },
          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
        region: [
          { required: true, message: '请选择活动区域', trigger: 'change' }
        ],
        date1: [
          { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
        ],
        date2: [
          { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
        ],
        type: [
          { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
        ],
        resource: [
          { required: true, message: '请选择活动资源', trigger: 'change' }
        ],
        desc: [
          { required: true, message: '请填写活动形式', trigger: 'blur' }
        ]
      }
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    confirm() {
      this.dialogVisibleDistribution = false
    },
    CloseOne() {
      this.dialogVisibleDistribution = false
    },
    // 添加权限关闭事件
    CloseDistribution() {
      this.dialogVisibleDistribution = false
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
      console.log(this.multipleSelection)
    },
    //   编辑按钮点击事件
    edit() {
      this.dialogVisiblebianji = true
    },
    // 增加按钮
    handleClick(row) {
      console.log(row)
      this.dialogVisibleDistribution = true
    },
    //   表格斑马线颜色
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 == 0) {
        return 'warning-row'
      } else if (rowIndex % 2 == 1) {
        return 'success-row'
      }
      return ''
    }
  }
}
</script>

<style scoped lang="scss">
.table-box{
    width:100%;
    height:100px;
}
.login-container {
  margin-top: 50px;
}
.operation {
  display: flex;
  margin: 0 0 10px 0px;
  height: 50px;
  box-shadow: 3px 0px 3px #01726e;
  padding: 5px 0 0 20px;
  div {
    height: 40px;
  }
}
.header {
  box-shadow: 3px 0px 3px #01726e;
  margin-top: 30px;
  padding-left: 30px;
  padding-top: 15px;
  //   margin-bottom:10px;
}
// dialog样式
.closeing {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background-color: #27bdb0;
  position: absolute;
  top: 0px;
  right: -32px;
  opacity: 1;
  .iconc {
    color: #000000;
    display: block;
    width: 30px;
    height: 30px;
    font-size: 20px;
    opacity: 1;
    line-height: 30px;
    text-align: center;
  }
}
.header-title {
  position: absolute;
  width: 100%;
  height: 45px;
  left: 0;
  top: 0;
  background-color: #27bdb0;
}
.closeing:hover {
  background-color: #006f6b !important;
}
</style>
<style>
/* 表格斑马线颜色设置 */
.el-table .warning-row {
  background: #f3fdfc;
}

.el-table .success-row {
  background: #fff;
}
</style>

